import { GaRegExp, RegExpInput } from "../InjectionRule";
import { blankRemove } from "./blank-remove";

export function MakeListRule(info: RegExpInput[], separator = ",", endEmpty = true, maybeEmpty = true): RegExpInput[] {
	const rule = new GaRegExp();
	rule.ParseRule([
		blankRemove,
		"(", ...info, ")", blankRemove,
		"(-", separator, "(-", blankRemove, rule, ")?", ")", endEmpty ? "?" : "",
	]);
	return ["(", rule, maybeEmpty ? "?" : "", blankRemove, ")"];
}
